package app.enums;

/**
 *
 * @author Kseniya Artsiukhova <kartsiukhova@productiveedge.com>
 */
public enum GenreCode {

    RUSSIAN_CLASSICAL("RCLASSICAL", "russian classical"),
    RUSSIAN_MODERN("RMODERN", "russian modern"),
    FOREIGN_CLASSICAL("FCLASSICAL", "foreign classical"),
    FOREIGN_MODERN("FMODERN", "foreign modern"),
    FANTASY("FANTASY", "fantasy"),
    BELLES_LETTRES("BLETT", "belles-lettres"),
    EDUCATION_AND_DEVELOPMENT("EDUDEV", "education and development"),
    ENCYCLOPEDIA("ENCYC", "encyclopedia"),
    MARKETING_AND_ADVERTISEMENT("MARKETADVERT", "marketing and advertisement"),
    MANAGEMENT("MANAG", "management"),
    ENTERPRISING("ENTERPR", "enterprising"),
    AUDIT_AND_ACCOUNTING("AUDACC", "audit and accounting"),
    ECONOMICS("ECONOM", "economics"),
    FINANCES_AND_BANKING("FINBANK", "finances and banking"),
    PROGRAMMING_LANGUAGES("PROGRAMMLANG", "programming languages"),
    SOFTWARE_DEVELOPMENT("SOFTDEV", "software development"),
    INTERNET("INTNET", "Internet"),
    GRAPHICS_DESIGN_MULTIMEDIA("GDM", "graphics. design. multimedia.");
    
    private String code;
    private String genreName;

    private GenreCode(String code, String genreName) {
        this.code = code;
        this.genreName = genreName;
    }

    public String getCode() {
        return code;
    }

    public String getGenreName() {
        return genreName;
    }

    public static GenreCode getGenreCodeByCode(String code) {
        GenreCode genreCode = null;
        
        for (GenreCode gc : values()) {
            if (code.equals(gc.getCode())) {
                genreCode = gc;
            }
        }
        return genreCode;
    }

    public static GenreCode getGenreCodeByGenreName(String genreName) {
        GenreCode genreCode = null;
        
        for (GenreCode gc : values()) {
            if (genreName.equals(gc.getGenreName())) {
                genreCode = gc;
            }
        }
        return genreCode;
    }
}
